using System;
using System.Data;

using Wicresoft.Common;

namespace Wicresoft.Messages.Entity
{
    [Table("PoolHistory", "", "Wicresoft.Messages.ConnectionString")]
    public class PoolHistory : Info
    {
        #region SQL column name consts
        public const string SQLCOL_POOLHISTORYID = "PoolHistoryID";
        public const string SQLCOL_POOLID = "PoolID";
        public const string SQLCOL_MESSAGEID = "MessageID";
        public const string SQLCOL_USERNAME = "UserName";
        public const string SQLCOL_CREATETIME = "CreateTime";
        public const string SQLCOL_DUETIME = "DueTime";
        public const string SQLCOL_ISTIMEOUT = "IsTimeOut";
        public const string SQLCOL_DESCRIPTION = "Description";
        public const string SQLCOL_POOLFEATURE = "PoolFeature";
        #endregion


        #region Contructors
        /// <summary>
        /// Construct empty entity
        /// </summary>
        public PoolHistory() { }

        /// <summary>
        /// Construct entity by primary key, other fields will be assigned by 
        /// "Load" method.
        /// </summary>
        public PoolHistory(Guid PoolHistoryID)
        {
            this.PoolHistoryID = PoolHistoryID;
        }
        #endregion

        public override void Init(DataRow row)
        {
            PoolHistoryID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_POOLHISTORYID]);
            PoolID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_POOLID]);
            MessageID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_MESSAGEID]);
            UserName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_USERNAME]);
            CreateTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_CREATETIME]);
            DueTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_DUETIME]);
            IsTimeOut = (bool)ObjectType.BooleanTypeHelper.Read(row[SQLCOL_ISTIMEOUT]);
            Description = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_DESCRIPTION]);
            PoolFeature = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_POOLFEATURE]);
        }

        #region Properties
        #region Property <Guid> PoolHistoryID
        [Property("PoolHistoryID", 16, SqlDbType.UniqueIdentifier, false, true)]
        public Guid PoolHistoryID
        {
            get { return _PoolHistoryID; }
            set { _PoolHistoryID = value; }
        }
        private Guid _PoolHistoryID = Guid.Empty;
        #endregion

        #region Property <Guid> PoolID
        [Property("PoolID", 16, SqlDbType.UniqueIdentifier, false, false)]
        public Guid PoolID
        {
            get { return _PoolID; }
            set { _PoolID = value; }
        }
        private Guid _PoolID = Guid.Empty;
        #endregion

        #region Property <Guid> MessageID
        [Property("MessageID", 16, SqlDbType.UniqueIdentifier, false, false)]
        public Guid MessageID
        {
            get { return _MessageID; }
            set { _MessageID = value; }
        }
        private Guid _MessageID = Guid.Empty;
        #endregion

        #region Property <string> UserName
        [Property("UserName", 100, SqlDbType.NVarChar, false, false)]
        public string UserName
        {
            get { return _UserName; }
            set { _UserName = value; }
        }
        private string _UserName = null;
        #endregion

        #region Property <DateTime> CreateTime
        [Property("CreateTime", 16, SqlDbType.DateTime, false, false)]
        public DateTime CreateTime
        {
            get { return _CreateTime; }
            set { _CreateTime = value; }
        }
        private DateTime _CreateTime = DateTime.MinValue;
        #endregion

        #region Property <DateTime> DueTime
        [Property("DueTime", 16, SqlDbType.DateTime, false, false)]
        public DateTime DueTime
        {
            get { return _DueTime; }
            set { _DueTime = value; }
        }
        private DateTime _DueTime = DateTime.MinValue;
        #endregion

        #region Property <bool> IsTimeOut
        [Property("IsTimeOut", 1, SqlDbType.Bit, false, false)]
        public bool IsTimeOut
        {
            get { return _IsTimeOut; }
            set { _IsTimeOut = value; }
        }
        private bool _IsTimeOut = false;
        #endregion

        #region Property <string> Description
        [Property("Description", 2147483646, SqlDbType.NText, false, false)]
        public string Description
        {
            get { return _Description; }
            set { _Description = value; }
        }
        private string _Description = null;
        #endregion

        #region Property <int> PoolFeature
        [Property("PoolFeature", 4, SqlDbType.Int, false, false)]
        public int PoolFeature
        {
            get { return _PoolFeature; }
            set { _PoolFeature = value; }
        }
        private int _PoolFeature = int.MinValue;
        #endregion
        #endregion




    }
}
